package com.cyan.note.enums;

import lombok.Getter;

/**
 * 订单类型枚举
 * 
 * @author ZhangzhenYu
 * @since 2025-01-13
 */
@Getter
public enum OrderType {
    
    /**
     * 陪玩单（按小时计费）
     */
    COMPANION("companion", "陪玩单"),
    
    /**
     * 护航单（按目标计费）
     */
    ESCORT("escort", "护航单");

    private final String code;
    private final String name;

    OrderType(String code, String name) {
        this.code = code;
        this.name = name;
    }

    /**
     * 根据code获取枚举
     */
    public static OrderType fromCode(String code) {
        for (OrderType type : values()) {
            if (type.code.equals(code)) {
                return type;
            }
        }
        throw new IllegalArgumentException("未知的订单类型: " + code);
    }
}